package com.ruoyi.web.TemuFzProductRestriction.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.TemuFzProductRestriction.domain.TemuFzProductRestriction;
import com.ruoyi.web.TemuFzProductRestriction.service.ITemuFzProductRestrictionService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * TemuFzProductRestrictionController
 * 
 * @author ruoyi
 * @date 2025-08-07
 */
@RestController
@RequestMapping("/TemuFzProductRestriction/TemuFzProductRestriction")
public class TemuFzProductRestrictionController extends BaseController
{
    @Autowired
    private ITemuFzProductRestrictionService temuFzProductRestrictionService;

    /**
     * 查询TemuFzProductRestriction列表
     */
    @PreAuthorize("@ss.hasPermi('TemuFzProductRestriction:TemuFzProductRestriction:list')")
    @GetMapping("/list")
    public TableDataInfo list(TemuFzProductRestriction temuFzProductRestriction)
    {
        startPage();
        List<TemuFzProductRestriction> list = temuFzProductRestrictionService.selectTemuFzProductRestrictionList(temuFzProductRestriction);
        return getDataTable(list);
    }

    /**
     * 导出TemuFzProductRestriction列表
     */
    @PreAuthorize("@ss.hasPermi('TemuFzProductRestriction:TemuFzProductRestriction:export')")
    @Log(title = "TemuFzProductRestriction", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TemuFzProductRestriction temuFzProductRestriction)
    {
        List<TemuFzProductRestriction> list = temuFzProductRestrictionService.selectTemuFzProductRestrictionList(temuFzProductRestriction);
        ExcelUtil<TemuFzProductRestriction> util = new ExcelUtil<TemuFzProductRestriction>(TemuFzProductRestriction.class);
        util.exportExcel(response, list, "TemuFzProductRestriction数据");
    }

    /**
     * 获取TemuFzProductRestriction详细信息
     */
    @PreAuthorize("@ss.hasPermi('TemuFzProductRestriction:TemuFzProductRestriction:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(temuFzProductRestrictionService.selectTemuFzProductRestrictionById(id));
    }

    /**
     * 新增TemuFzProductRestriction
     */
    @PreAuthorize("@ss.hasPermi('TemuFzProductRestriction:TemuFzProductRestriction:add')")
    @Log(title = "TemuFzProductRestriction", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TemuFzProductRestriction temuFzProductRestriction)
    {
        return toAjax(temuFzProductRestrictionService.insertTemuFzProductRestriction(temuFzProductRestriction));
    }

    /**
     * 批量新增TemuFzProductRestriction
     */
    @PreAuthorize("@ss.hasPermi('TemuFzProductRestriction:TemuFzProductRestriction:add')")
    @Log(title = "TemuFzProductRestriction", businessType = BusinessType.INSERT)
    @PostMapping("/batch")
    public AjaxResult batchAdd(@RequestBody List<TemuFzProductRestriction> list) {
        return toAjax(temuFzProductRestrictionService.insdatas(list));
    }

    /**
     * 修改TemuFzProductRestriction
     */
    @PreAuthorize("@ss.hasPermi('TemuFzProductRestriction:TemuFzProductRestriction:edit')")
    @Log(title = "TemuFzProductRestriction", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TemuFzProductRestriction temuFzProductRestriction)
    {
        return toAjax(temuFzProductRestrictionService.updateTemuFzProductRestriction(temuFzProductRestriction));
    }

    /**
     * 删除TemuFzProductRestriction
     */
    @PreAuthorize("@ss.hasPermi('TemuFzProductRestriction:TemuFzProductRestriction:remove')")
    @Log(title = "TemuFzProductRestriction", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(temuFzProductRestrictionService.deleteTemuFzProductRestrictionByIds(ids));
    }
}
